//
//  XMLElement.h
//  XMLBuilder
//
//  Created by shchen on 16/4/5.
//  Copyright © 2016年 shchen. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface XMLElement : NSObject
@property(nonatomic,copy)NSString *content;//内容
@property(nonatomic,copy)NSString *elementName;//节点元素名
@property(nonatomic,strong)NSMutableDictionary *elementAttritude;//属性
@property(nonatomic,strong)XMLElement *parent;//父节点
@property(nonatomic,strong)NSMutableArray *childs;//保存子节点的数组
+(XMLElement* )elementWithString:(NSString *)elementName;
+(XMLElement* )elementWithString:(NSString *)elementName content:(NSString *)content;
#pragma mark -要求1
//增加子节点,成功返回YES,失败返回NO
- (BOOL)addChildElement:(XMLElement *)element;
//删除子节点,成功返回YES,失败返回NO
- (BOOL)deleteChildElement:(XMLElement *)element;
//通过子节点名删除子节点,成功返回YES,失败返回NO
- (BOOL)deleteChildElementByElementName:(NSString *)elementName;
#pragma mark -要求2
//获取父节点
- (XMLElement *)parent;
//获取包含所有子节点的数组
- (NSMutableArray *)childs;
#pragma mark -要求3
//读取节点属性，返回属性的字典
- (NSMutableDictionary* )elementAttritude;
//增加属性,成功返回YES,失败返回NO
- (BOOL)addElementAttritudeForElementAttritudeKey:(NSString*)key forValue:(NSString*)value;
//删除属性,成功返回YES,失败返回NO
- (BOOL)deleteElementAttritudeKey:(NSString* )key;
#pragma mark -要求4
//打印当前节点和所有子节点（包括子孙节点）的内容,以XML的形式输出。
- (NSString *)XMLPrint;



@end
